#!/usr/bin/evn python
# -*- coding: UTF-8 -*-
# @File: common_func.py
# @Author: fy
# @date: 2021/9/6 14:16
import os
import yaml


def getProjectDir():
    '''
    获取当前工程绝对路径
    :return:
    '''
    cur_project_dir = ""
    cur_dir = os.getcwd()
    print(cur_dir)
    iIndex = cur_dir.find("WeChatApp")
    if iIndex != -1:
        cur_project_dir = cur_dir[0: iIndex + len("WeChatApp")]
    if cur_project_dir[-1] != "/" or cur_project_dir[-1] != "\\":
        cur_project_dir = cur_project_dir + "\\"
    print(cur_project_dir)
    return cur_project_dir


def get_manual_input_data():
    data_path = getProjectDir() + "datas/manual_input_member.yaml"
    datas = {}
    with open(data_path, encoding="utf-8") as f:
        datas = yaml.safe_load(f)
    return datas
    pass


def get_delete_member_data():
    data_path = getProjectDir() + "datas/delete_member.yaml"
    datas = {}
    with open(data_path, encoding="utf-8") as f:
        datas = yaml.safe_load(f)
    return datas
    pass


def test_get_project_dir():
    getProjectDir()


def test_get_manual_input_data():
    datas = get_manual_input_data()
    right_data = datas.get('rightdata')
    print(right_data)

def test_get_delete_data():
    datas = get_delete_member_data()
    right_data = datas.get('rightdata')
    print(right_data)